package com.zff.rental.service.dict;

import com.zff.rental.entity.dict.HouseType;
import com.zff.rental.repository.dict.HouseTypeRepository;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author HCY
 */
@Service
public class HouseTypeServer {
    @Resource
    private HouseTypeRepository houseTypeRepository;

    public Boolean add(String params) {
        houseTypeRepository.save(new HouseType(params));
        return true;
    }

    public Boolean remove(String id) {
        houseTypeRepository.deleteById(id);
        return true;
    }

    public List<String> list() {
        return houseTypeRepository.findAll().stream().map(HouseType::getHouseType).collect(Collectors.toList());
    }
}
